﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using L = Science.Mathematics.LinearAlgebra;

namespace Strang3Ed.Chapter07.Section4
{
    public class Example03
    {
        public Example03()
        {
        }
        private string result;
        public string Result
        {
            get { return result; }
        }
        public void Compute()
        {
            double[,] x = { {2.0, 2.0}, 
                            {-1.0, 1.0}};

            L.Matrix A = new L.Matrix(x);

            L.FactorizationAeqQH obj = new L.FactorizationAeqQH(A);
            obj.Compute();

            result += obj.Orthogonal.ToString() + "\r\n";

            result += obj.PositiveSemidefinite.ToString() + "\r\n";

            result += (obj.Orthogonal*obj.PositiveSemidefinite).ToString() + "\r\n";
        }
    }
}
/*
0.707106781186547     0.707106781186547     
-0.707106781186547     0.707106781186547     


2.12132034355964     0.707106781186547     
0.707106781186547     2.12132034355964     


2     2     
-1     0.999999999999999     
*/
